#include"queue.h"

#define NAMESIZE 32

typedef struct
{
     int id;
     char name[NAMESIZE];
     int math;
     int chinese;

}score;

void print_s(score * sco)
{
     printf("%d %s %d %d\n", sco->id, sco->name, sco->math, sco->chinese);
}

int main(void)
{
     QUEUE *q = queue_create(sizeof(score));
     if(q == NULL)
          exit(1);
     score tmp;
     for(int i = 0;i<7;i++)
     {
          tmp.id = i;
          snprintf(tmp.name, NAMESIZE, "stu%d", i);
          tmp.math = rand() % 100;
          tmp.chinese = rand() % 100;
          queue_enqueue(q,&tmp);
     }

     while (1)
     {
          int ret = queue_dequeue(q, &tmp);
          if (ret == -1)
               break;
          print_s(&tmp);
     }

     queue_destory(&q);

     return 0;
}
